
*********************************************************************************************************************************************
**Replication for models 1-7, Tables 1 and 2, in "Different in Asia?: Developmental States, Trade, and International Conflict Onset and    **
**Escalation", International Relations of the Asia Pacific 13, 2: 175-205.																   **
*********************************************************************************************************************************************
**Please note an error in the published tables: the sign of the coefficient for the cubed peace years term should be negative in each model**
*********************************************************************************************************************************************


***Table 1

**Model 1

#del;

***you must indicate the location of the replication files on your computer below, or use 'cd';

set memory 500m;
set more off;

use "Goldsmith_RepData_IRAP2013.dta", clear;


heckprob  fcwmid251  lnTradeVolumeGledd  GDPShareGledLow   
lncap_12 jntautoc if  fcwjomid~=1 &  year>1959 & IntraRegion==1, 

select( fcwmidinit = lnTradeVolumeGledd  GDPShareGledLow   
parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3);

		  
***Model 2	;	  

#del;

set more off;

heckprob  fcwmid251  lnTradeVolumeGledd lnTradeVolumeGleddXAPNEA GDPShareGledLow  GDPShareGledLowXAPNEA  AsiaPacNotEastAsia
lncap_12 jntautoc if  fcwjomid~=1 &  year>1959 & IntraRegion==1, 

select( fcwmidinit = lnTradeVolumeGledd lnTradeVolumeGleddXAPNEA GDPShareGledLow  GDPShareGledLowXAPNEA  AsiaPacNotEastAsia
parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3);

	
***Model 3;
	
	
#del;

set more off;

heckprob  fcwmid251  lnTradeVolumeGledd lnTradeVolumeGleddXEastAsia GDPShareGledLow  GDPShareGledLowXEastAsia EastAsia
lncap_12 jntautoc if  fcwjomid~=1 &  year>1959 & IntraRegion==1, 

select( fcwmidinit = lnTradeVolumeGledd lnTradeVolumeGleddXEastAsia GDPShareGledLow  GDPShareGledLowXEastAsia EastAsia
parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3);
		  

***Model 4;
	
	
#del;

set more off;

heckprob  fcwmid251  lnTradeVolumeGledd lnTradeVolumeGleddXDevStatMon GDPShareGledLow  GDPShareGledLowXDevStatMon DevStatMon
lncap_12 jntautoc if  fcwjomid~=1 &  year>1949 & IntraRegion==1 , 

select( fcwmidinit = lnTradeVolumeGledd lnTradeVolumeGleddXDevStatMon GDPShareGledLow  GDPShareGledLowXDevStatMon DevStatMon
parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3);
 		  
		  
		  
		  
****Table 2;


***Model 5;
		  
#del;

set more off;

heckprob  fcwmid251  lnTradeVolumeGledd  GDPShareGledLow   
lncap_12 jntautoc if  fcwjomid~=1 &  year>1959 &  IntraRegionNEA==1, 

select( fcwmidinit = lnTradeVolumeGledd  GDPShareGledLow   
parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3);

***Model 6;

#del;

set more off;

heckprob  fcwmid251  lnTradeVolumeGledd  GDPShareGledLow   
lncap_12 jntautoc if  fcwjomid~=1 &  year>1959 &  EastAsia==1, 

select( fcwmidinit = lnTradeVolumeGledd  GDPShareGledLow   
parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3);		  

		  
***Model 7;

#del;

set more off;

heckprob  fcwmid251  lnTradeVolumeGledd  GDPShareGledLow   
lncap_12 jntautoc if  fcwjomid~=1 &  year>1949 &  DevStatMon==1 & IntraRegion==1 , 

select( fcwmidinit = lnTradeVolumeGledd  GDPShareGledLow   
parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3);	
		  
		  
		  
		  
*****************Examples of simulations for marginal effects;



*****************Figure 2 bottom right panel;



#del;


set more off;


summarize fcwmidinit lnTradeVolumeGledd TradeVolumeGledd GDPShareGledLow parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if  IntraRegion==1 ;

		  
centile fcwmidinit lnTradeVolumeGledd TradeVolumeGledd GDPShareGledLow parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if IntraRegion==1 , centile (50);
#del;
		  
centile fcwmidinit 	lnTradeVolumeGledd TradeVolumeGledd GDPShareGledLow parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if IntraRegion==1 , centile (20 80);
		  
#del;
			  
summarize GDPShareGledLow TradeVolumeGledd lnTradeVolumeGledd if  lnTradeVolumeGledd <= (3.550385) 
&   lnTradeVolumeGledd >=(3.4814) & IntraRegion==1 ;


#del;

gen GDPShareGledLowK = GDPShareGledLow*1000;

set more off;

probit fcwmidinit GDPShareGledLowK  lnTradeVolumeGledd parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if fcwjomid~=1 & IntraRegion==1 & DevStatMon~=1, vce(cluster dyadid)  ;


		  
		  
		  
  
  preserve;
drawnorm MG_b1-MG_b13, n(10000) means(e(b)) cov(e(V)) clear;



postutil clear;
postfile mypost prob_hat1 lo1 hi1  
            using sim , replace;
            noisily display "start";
			

			
			
local a=  3.93e-06*1000;
while `a' <= .0226933*1000 { ;

    {;


scalar h_lnTradeVolumeGledd=  3.517241 ;
scalar h_parity =  .5402865;
scalar h_lncap_12 = -4.309222;
scalar h_s_wt_glo = .603865;
scalar h_jntdemord = 3;
scalar h_jntautoc = 0;
scalar h_contig24 = 1;
scalar h_lndistance =  6.572282;
scalar h_cwpceyrs = 5;
scalar h_cwpceyrs2 = 25;
scalar h_cwpceyrs3 = 125;
scalar h_constant=1;


    
    
    generate x_betahat1 = MG_b1*(`a')
                            + MG_b2*h_lnTradeVolumeGledd
                            + MG_b3*h_parity
                            + MG_b4*h_lncap_12
							+ MG_b5*h_s_wt_glo
							+ MG_b6*h_jntdemord
							+ MG_b7*h_jntautoc
							+ MG_b8*h_contig24
                         	+ MG_b9*h_lndistance
                            + MG_b10*h_cwpceyrs
                            + MG_b11*h_cwpceyrs2
                            + MG_b12*h_cwpceyrs3
							+ MG_b13*h_constant;
 
    
    
    gen prob1=normal(x_betahat1);
  
    
  
    egen probhat1=mean(prob1);
 
    
    tempname prob_hat1 lo1 hi1  ;  
 
    
    _pctile prob1, p(2.5,97.5);
    scalar `lo1'= r(r1);
    scalar `hi1'= r(r2);  
    
 

   

    scalar `prob_hat1'=probhat1;

    
    post mypost (`prob_hat1') (`lo1') (`hi1') 
                ;
    };      
    drop x_betahat1 prob1 probhat1  ;
    local a=`a'+ 1 ;
    display "." _c;
    } ;

display "";

postclose mypost;


#del;

use sim, clear;

gen MV = _n-(1-(3.93e-06*1000));



graph twoway line prob_hat1 MV, clwidth(medium thick) clcolor(cranberry) clcolor(cranberry)
        ||   line lo1  MV, clpattern(dash) clwidth(thin) clcolor(black)
        ||   line hi1  MV, clpattern(dash) clwidth(thin) clcolor(black)
        ||  ,   
            xlabel(3.93e-03 022.6933, labsize(3)) 
            ylabel(0 0.05 0.1 0.15 0.2, labsize(3))
            yscale(noline)
            xscale(noline)
            yline(0)
            legend(off)
            title("Probability of MID Onset as Trade Interdependence Increases", size(3.5))
            subtitle(" " "Dyads w/out Developmental State: Contiguous States at Risk of Conflict" " ", size(3.5))
            xtitle("GDPshare(lower)", size(3.5)  )
            ytitle("Probability", size(3))
            xsca(titlegap(2))
            ysca(titlegap(2))
            scheme(s2mono) graphregion(fcolor(white));




****************Figure 2 bottom left panel;


#del;



restore;



#del;
set more off;


summarize fcwmidinit lnTradeVolumeGledd TradeVolumeGledd GDPShareGledLow parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if  IntraRegion==1 ;

		  
centile fcwmidinit lnTradeVolumeGledd TradeVolumeGledd GDPShareGledLow parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if IntraRegion==1 , centile (50);
#del;
		  
centile fcwmidinit 	lnTradeVolumeGledd TradeVolumeGledd GDPShareGledLow parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if IntraRegion==1 , centile (20 80);
		  
#del;
			  
summarize GDPShareGledLow TradeVolumeGledd lnTradeVolumeGledd if  lnTradeVolumeGledd <= (3.550385) 
&   lnTradeVolumeGledd >=(3.4814) & IntraRegion==1 ;


#del;

set more off;



probit fcwmidinit GDPShareGledLowK  lnTradeVolumeGledd parity    lncap_12 s_wt_glo  jntdemord  jntautoc
          contig24  lndistance   cwpceyrs cwpceyrs2 cwpceyrs3 if fcwjomid~=1 & IntraRegion==1 & DevStatMon==1, vce(cluster dyadid)  ;


		  
		  
		  
  
  preserve;
drawnorm MG_b1-MG_b13, n(10000) means(e(b)) cov(e(V)) clear;



postutil clear;
postfile mypost prob_hat1 lo1 hi1  
            using sim , replace;
            noisily display "start";
			

			
			
local a=  3.93e-06*1000;
while `a' <= .0226933*1000 { ;

    {;


scalar h_lnTradeVolumeGledd=  3.517241 ;
scalar h_parity =  .5402865;
scalar h_lncap_12 = -4.309222;
scalar h_s_wt_glo = .603865;
scalar h_jntdemord = 3;
scalar h_jntautoc = 0;
scalar h_contig24 = 1;
scalar h_lndistance =  6.572282;
scalar h_cwpceyrs = 5;
scalar h_cwpceyrs2 = 25;
scalar h_cwpceyrs3 = 125;
scalar h_constant=1;


    
    
    generate x_betahat1 = MG_b1*(`a')
                            + MG_b2*h_lnTradeVolumeGledd
                            + MG_b3*h_parity
                            + MG_b4*h_lncap_12
							+ MG_b5*h_s_wt_glo
							+ MG_b6*h_jntdemord
							+ MG_b7*h_jntautoc
							+ MG_b8*h_contig24
                         	+ MG_b9*h_lndistance
                            + MG_b10*h_cwpceyrs
                            + MG_b11*h_cwpceyrs2
                            + MG_b12*h_cwpceyrs3
							+ MG_b13*h_constant;
 
    
    
    gen prob1=normal(x_betahat1);
  
    
  
    egen probhat1=mean(prob1);
 
    
    tempname prob_hat1 lo1 hi1  ;  
 
    
    _pctile prob1, p(2.5,97.5);
    scalar `lo1'= r(r1);
    scalar `hi1'= r(r2);  
    
 

   

    scalar `prob_hat1'=probhat1;

    
    post mypost (`prob_hat1') (`lo1') (`hi1') 
                ;
    };      
    drop x_betahat1 prob1 probhat1  ;
    local a=`a'+ 1 ;
    display "." _c;
    } ;

display "";

postclose mypost;


#del;

use sim, clear;

gen MV = _n-(1-(3.93e-06*1000));



graph twoway line prob_hat1 MV, clwidth(medium thick) clcolor(cranberry) clcolor(cranberry)
        ||   line lo1  MV, clpattern(dash) clwidth(thin) clcolor(black)
        ||   line hi1  MV, clpattern(dash) clwidth(thin) clcolor(black)
        ||  ,   
            xlabel(3.93e-03 022.6933, labsize(3)) 
            ylabel(0 0.05 0.1 0.15 0.2, labsize(3))
            yscale(noline)
            xscale(noline)
            yline(0)
            legend(off)
            title("Probability of MID Onset as Trade Interdependence Increases", size(3.5))
            subtitle(" " "Dyads w Developmental State: Contiguous States at Risk of Conflict" " ", size(3.5))
            xtitle("GDPShare(lower)", size(3.5)  )
            ytitle("Probability", size(3))
            xsca(titlegap(2))
            ysca(titlegap(2))
            scheme(s2mono) graphregion(fcolor(white));

